package org.tissou.server.importer;

import org.tissou.client.Services.CategorieInfos;

import java.util.Map;
import java.util.HashMap;

import org.tissou.server.Utils.Variables_Globales;
import org.tissou.server.Base.Categorie;

/**
 * Created by IntelliJ IDEA.
 * User: Manu
 * Date: 6 juin 2009
 * Time: 11:56:22
 * To change this template use File | Settings | File Templates.
 */
public class MappeurQuoiVersCategorie implements MappeurDeCategorie {

  String quoi;

  Categorie Tout = Variables_Globales.Tout;

  public MappeurQuoiVersCategorie(String quoi) {
    this.quoi = quoi;
  }

  public String getLibelle() {
    return quoi;
  }

  public CategorieInfos getCategorie() {
    CategorieInfos cat =  null;
    String quoi = this.quoi.toLowerCase();
    Map<String, String> mapping = new HashMap<String, String>();
    mapping.put("appart - loyer", "Appart - Loyer");
    mapping.put("loyer", "Appart - Loyer");
    mapping.put("Restaurant", "Restau");
    mapping.put("m&s", "M&S");
    mapping.put("sainsbury", "Sainsbury's");
    mapping.put("sainsburys", "Sainsbury's");
    mapping.put("sainsbury's", "Sainsbury's");
    mapping.put("saintsbury's", "Sainsbury's");
    mapping.put("sainsbury's", "Sainsbury's");
    mapping.put("appart - charges", "Appart - Charges");
    mapping.put("transfert bnp -> pound", "Transfert - euro vers pound");
    mapping.put("tendon casse", "Sante");
    mapping.put("r,tablissement", "Retablissement");
    mapping.put("sant,", "Sante");
    mapping.put("sant,", "Sante");
    if (mapping.containsKey(quoi)) {
      cat = Tout.rechercherCategorieDansDescendance(mapping.get(quoi)).getInfos();
    } else {
      cat = Tout.rechercherCategorieDansDescendance(quoi).getInfos();
    }
    return cat;
  }
}
